﻿
			
		<!-- Main Content -->
		<div class="span-19 last" id="content" >
			<?php if(!$this->session->userdata('care_id')): ?>
			<div class="span-19 last" align="right" style="margin-top: 30px;">
				<a id="add"><img src="<?php echo base_url(); ?>img/add_noti_th.png" /></a>
			</div>
			<?php endif; ?>
			<?php if(!$med): ?>
			<div>There are no medicines that need to be taken at this current moment</div>
			<?php else: ?>
			<table class="span-16 last" border="1" style="margin-left:auto; margin-right:auto; margin-top:40px">
				  <tr>
					<td width="180"><div align="center"><strong><span class="Arial">ชื่อยา</span></strong></div></td>
					<td width="180"><div align="center"><strong><span class="Arial">ช่วงเวลา</span></strong></div></td>
					<td width="180"><div align="center"><strong><span class="Arial">มื้อ</span></strong></div></td>
					<td width="130"><div align="center"><strong><span class="Arial">จำนวน</span></strong></div></td>
					<td width="180"><div align="center"><strong><span class="Arial">หมายเหตุ</span></strong></div></td>
				  </tr>
				<?php $id = 0; ?>
				<?php  foreach($med as $m): ?>
				<?php $mid = $m->med_id; ?>
				<?php if($mid == $id): ?>
				  <tr>
					<td><div align="center"></div></td>
					<td><div align="center"></div></td>
					<td><div align="center"><?php echo $m->time;?></div></td>
					<td><div align="center"></div></td>
					<td><div align="center"></div></td>
				  </tr>
				  
				<?php else: ?>
				<?php $id = $m->med_id; ?>
				  <tr>
					<td><div align="center"><?php echo $m->med_name; ?><br/>(<?php echo $m->type; ?>)</div></td>
					<td><div align="center"><?php echo $m->routine;?></div></td>
					<td><div align="center">
					<?php if($m->time_id != 5): echo $m->time; endif;?>
					</div></td>
					<td>
						<div align="center"><?php echo $m->dose;?>
							<?php switch($m->unit_id){
									case 1 : echo "เม็ด"; break;
									case 2 : echo "ช้อนชา"; break;
									case 3 : echo "ช้อนโต๊ะ"; break;
									case 4 : echo "ครั้ง"; break;
									case 5 : echo "เข็ม"; break;
									case 6 : echo "ยูนิต"; break;
									case 7 : echo "หยด"; break;
									case 8 : echo "cc"; break;
								  }
							?>
						</div>
					</td>
					<td><div align="center"><?php if($m->detail): echo $m->detail; endif; ?></div><td>
				  </tr>
					
				<?php endif; endforeach; endif; ?>
				</table>
			  </div>
			  <p>&nbsp;</p>
			  <p>&nbsp;</p></td>
			</tr>
		  </table>
		  <div class="prepend-5 span-9 last">
			<img src="<?php echo base_url(); ?>/img/edit.png" />
		  </div>
		</div>
		
		
	</div>
	<div id="med_add">
<form action="" method="post"> 
		<label>Medicine Name:</label> 
		<input type="text" name="med_name" id="med_name" />
		<br/>
		<label>Type</label>
		<select id="type">
			<option>---SELECT TYPE---</option>
			<option>ยาเม็ด</option>
			<option>ยาน้ำ</option>
			<option>ยาทา</option>
			<option>ยาพ่น</option>
			<option>ยาฉีด</option>
			<option>ยาหยอด</option>
			<option>อื่นๆ</option>
		</select>
		<br/>
		<div id="dose" style="display:none">
		<label>Dose:</label><input type="text" id="dose_input"/><label id="unit"></label>
		<select id="unit" style="display:none">
			<option>ช้อนชา</option>
			<option>ช้อนโต๊ะ</option>
		</select>
		</div>
		<div id="total" style="display:none">
		<label>Total:</label><input type="text" id="total_dose"/>
		</div>
		<label>Routine:</label> 
		<select id="routine">
			<option>---SELECT ROUTINE---</option>
			<option>Before Meal</option>
			<option>After Meal</option>
			<option>With Meal</option>
			<option>Right After Meal</option>
			<option>เมื่อมีอาการ</option>
			<option>Every...Hour(s)</option>
		</select>
		
		<div id="time" style="display: none;">
		<label>Time:</label>
		<input type="checkbox" name="breakfast" value="Breakfast"/>Breakfast
		<input type="checkbox" name="lunch" value="Lunch"/>Lunch
		<input type="checkbox" name="dinner" value="Dinner"/>Dinner
		<input type="checkbox" name="bedtime" value="Bedtime"/>Before Bed
		</div>
		
		<div id="time_text" style="display: none;">
			<input type="text" id="hour" /><label> hour(s)</label>
		</div>
		<br/>
		<label>Additional Instruction (eg. เคี้ยวให้ละเอียด, ทาบางบริเวณแผล )
</label>
		<textarea id="detail" cols="2" rows="2" /></textarea>
		<input id="add_b" type="button" value="Add Medical Notification" />
	</form>
</div>
	
	